<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of feedback
 *
 * @author Bliss 05
 */
class feedback extends CI_Controller {

  public function __construct() {
    parent::__construct();
  }

  public function index() {
    $contact_email = $this->setting_model->item('contact_email');
    if (empty($_POST['name']) || empty($_POST['email']) || !validate_email($_POST['email']) ||
            empty($_POST['comment'])) {
      
    } else {
      $this->load->library('sendEmail');
      $this->sendemail->sendEmailByTemplate(array(
          'from' => $_POST['email'] . '-' . $_POST['name'],
          'comment' => $_POST['comment'],
          'name' => $_POST['name'],
          'email' => $_POST['email'],
          'to' => $contact_email), 'end_user_comment_site');
      set_flash_message('Your comments was sent to our. Thank you!');
    }
    if (!empty($_POST['current_url'])) {
      redirect($_POST['current_url']);
    } else {
      redirect('');
    }
  }

}

